import { transform, WGS84, GCJ02 } from 'gcoord'

export default function (latitude, longitude, name, address) {
  const result = transform(
    [parseFloat(latitude, 10), parseFloat(longitude, 10)], // 经纬度坐标
    WGS84, // 当前坐标系
    GCJ02 // 目标坐标系
  )
  wx.openLocation({
    latitude: result[0],
    longitude: result[1],
    name,
    address,
    success (e) {
      console.log('调用微信地图success', e)
    },
    fail (e) {
      console.log('调用微信地图fail', e)
    },
  })
}
